<!--  -->
<template>
<div class="">
   <a-drawer :visible="modalVisible" width="90%" @close="handleClose">
      <a-divider orientation="left">申请记录附件信息</a-divider>
        <!-- <f-search-form>
            <f-search-form-item label="专业包代码" name="majorCode" />
            <f-search-form-item label="专业包名称" name="majorName" slot="advanced" />
            <f-search-form-item label="工程包代码" name="packageNo" slot="advanced" />
            <f-search-form-item label="工程包名称" name="packageName" slot="advanced" />
            <f-search-form-item label="申请人" name="userName" slot="advanced" />
            <f-search-form-item label="申请时间" name="applyTime" type="date" slot="advanced" />
            <f-search-form-item label="申请状态" name="state" slot="advanced" />
        </f-search-form> -->
      <f-table style="margin-top: 30px" 
        ref="table" 
        size="default"  
        rowKey="projectFileId"
        :columns="columns" 
        :multiple="false" 
        :params="queryParam" 
        :api="api.upFile.page" >
            <span slot="action" slot-scope="text, record">
                <template>
                    <a @click="download(record)">下载附件</a>
                </template>
            </span>
        </f-table>
    </a-drawer>
</div>
</template>
0
<script>
import api from '../../material/app/js/api'
import Vue from 'vue'
export default {
    name: 'ApplicationRecordFile',
    components: {},
    props: {},
    //import引入的组件需要注入到对象中才能使用
    data() {
        //这里存放数据
        const me = this
        return {
          api: Object.assign(api, this.api),
          //列表初始化查询参数
           queryParam: {},
            projectId: '',
            purchaseId: '',
            modalVisible: false,
            columns: [{
                    title: '文件名称',
                    dataIndex: 'fileName'
                },
                {
                    title: '上传人',
                    align: 'center',
                    dataIndex: 'userName'
                },
                {
                    title: '上传时间',
                    align: 'center',
                    dataIndex: 'createTime'
                },
                {
                    title: '操作',
                    align: 'center',
                    dataIndex: 'action',
                    width: 100,
                    scopedSlots: {
                        customRender: 'action'
                    }
                }
            ]
        }
    },
    //监听属性 类似于data概念
    computed: {},
    //监控data中的数据变化
    watch: {},
    //方法集合
    methods: {
        handleShow(data) {
            this.queryParam.projectId = data.projectId
            this.queryParam.purchaseId = data.purchaseId
            this.modalVisible = true
            this.$refs.table.refresh()
        },
        handleClose() {
            this.modalVisible = false
        },
        //下载附件
       download(record) {
        const token = Vue.ls.get('Access-Token')
        const params = {
            projectFileId: record.projectFileId
        }
        this.$downloadfile(this.api.upFile.downloadBase64, record.fileName, params, token)
       }
    },
    created() {
    }
}
</script>

<style lang="scss" scoped>
//@import url(); 引入公共css类
</style>
